<?php

class Application_Model_DbTable_News extends Zend_Db_Table_Abstract{
	protected $_name = 'news';

	public function fetchAllWithAuthor(){
		$select = $this->select();
		$select->setIntegrityCheck(false);

		$select	->from(array('n'=>$this->_name))
				->joinLeft(array('p'=>'personne'), 'n.author=p.id', array('nom','prenom'))
				->order('date DESC');
		return $select->query()->fetchAll(PDO::FETCH_OBJ);
	}
	public function deleteNews($id){
		$where = $this->getAdapter()->quoteInto('id = ?', $id);
		return parent::delete($where);
	}
}